package com.wuseguang.springcloud.controller;

import com.wuseguang.springcloud.service.TeacherChatService;
import com.wuseguang.springcloud.util.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author zm
 * @Description 教师留言
 * @Date 2020/9/13 11:06
 */
@RestController
@RequestMapping("/brands")
public class TeacherChatController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());


    @Autowired
    private TeacherChatService teacherChatService;


    /**
     * @Author zm
     * @Description 查询教师列表
     * @Date 2020/9/13 11:12
     */
    @RequestMapping("/queryTeacherList")
    public Result queryTeacherList(@RequestParam(value = "id") Integer id) {
        logger.info("教师留言/学生 id = {}", id);
        return teacherChatService.queryTeacherList(id);
    }

    /**
     * @Author zm
     * @Description 添加留言
     * @Date 2020/9/13 12:01
     */
    @RequestMapping("/addTeacherLeaveMessages")
    public Result addTeacherLeaveMessages(@RequestParam(value = "id") Integer id,
                                          @RequestParam(value = "type") Integer type,
                                          @RequestParam(value = "content") String content,
                                          @RequestParam(value = "tid") Integer tid) {
        logger.info("添加教师留言/学生 id = {}", id);
        return teacherChatService.addTeacherLeaveMessages(id, type, content, tid);
    }


    /**
     * @Author zm
     * @Description 查询教师留言
     * @Date 2020/9/14 9:50
     */
    @RequestMapping("/queryTeacherLeaveMessages")
    public Result queryTeacherLeaveMessages(@RequestParam(value = "id") Integer id,
                                            @RequestParam(value = "type") Integer type,
                                            @RequestParam(value = "tid") Integer tid) {
        logger.info("查询教师留言/学生 id = {}", id);
        return teacherChatService.queryTeacherLeaveMessages(id, type, tid);
    }
}
